/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.osiris.persistence;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author amartinez
 */
@Entity
@Table(name = "Detallerequisito")
@NamedQueries({@NamedQuery(name = "Detallerequisito.findAll", query = "SELECT d FROM Detallerequisito d"), @NamedQuery(name = "Detallerequisito.findByIdRequisito", query = "SELECT d FROM Detallerequisito d WHERE d.idRequisito = :idRequisito"), @NamedQuery(name = "Detallerequisito.findByFechaalta", query = "SELECT d FROM Detallerequisito d WHERE d.fechaalta = :fechaalta")})
public class Detallerequisito implements Serializable {
    private static final long serialVersionUID = 1L;
    @Lob
    @Column(name = "Detalle")
    private String detalle;
    @Lob
    @Column(name = "Origen")
    private String origen;
    @Id
    @Basic(optional = false)
    @Column(name = "idRequisito")
    private Long idRequisito;
    @Column(name = "Fecha_alta")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaalta;
    @JoinColumn(name = "idRequisito", referencedColumnName = "idRequisito", insertable = false, updatable = false)
    @OneToOne(optional = false, fetch = FetchType.LAZY)
    private Requisito requisito;
    @JoinColumn(name = "Usuario_alta", referencedColumnName = "idUsuario")
    @ManyToOne(optional = false, fetch = FetchType.LAZY)
    private Usuario usuarioalta;

    public Detallerequisito() {
    }

    public Detallerequisito(Long idRequisito) {
        this.idRequisito = idRequisito;
    }

    public String getDetalle() {
        return detalle;
    }

    public void setDetalle(String detalle) {
        this.detalle = detalle;
    }

    public String getOrigen() {
        return origen;
    }

    public void setOrigen(String origen) {
        this.origen = origen;
    }

    public Long getIdRequisito() {
        return idRequisito;
    }

    public void setIdRequisito(Long idRequisito) {
        this.idRequisito = idRequisito;
    }

    public Date getFechaalta() {
        return fechaalta;
    }

    public void setFechaalta(Date fechaalta) {
        this.fechaalta = fechaalta;
    }

    public Requisito getRequisito() {
        return requisito;
    }

    public void setRequisito(Requisito requisito) {
        this.requisito = requisito;
    }

    public Usuario getUsuarioalta() {
        return usuarioalta;
    }

    public void setUsuarioalta(Usuario usuarioalta) {
        this.usuarioalta = usuarioalta;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idRequisito != null ? idRequisito.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Detallerequisito)) {
            return false;
        }
        Detallerequisito other = (Detallerequisito) object;
        if ((this.idRequisito == null && other.idRequisito != null) || (this.idRequisito != null && !this.idRequisito.equals(other.idRequisito))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.osiris.persistence.Detallerequisito[idRequisito=" + idRequisito + "]";
    }

}
